package com.shg.web.ztest;


import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.shg.bean.OrderItem;
import com.shg.bean.SoldBook;
import com.shg.service.OrderItemService;

public class OrderItemServiceTest {

	static OrderItemService orderItemService;
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		ApplicationContext context=new ClassPathXmlApplicationContext("basics-application.xml");
		orderItemService=(OrderItemService)context.getBean("orderItemServiceBean");
		
	}

	@Test
	public void testSelect() {
		OrderItem item=null;
		try {
			item = (OrderItem) orderItemService.getItem("201203211056341111");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		for(SoldBook book:item.getSoldBooks()){
			System.out.println(book.getId());
		}
	}

}
